<%@ page contentType="text/html; charset=utf-8" language="java"    pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>蛋糕后台</title>
		<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
		<script type="text/javascript">
		function del(id){
			if (!confirm("确定删除吗？")){
				return false;
		    }
			jQuery.post("delBreadPrice",{id:id,r:Math.random()},function(json){
				if(json.success==1){
					 alert('操作成功');
					 location.href="addPrice?id=${bread.id}";
				}else{
					 alert('失败了，稍后重试');
				}
			},"json");
		}
		</script>
		<style type="text/css">
			<!--
			body,td,th {
				font-family: 宋体;
				font-size: 12px;
				color: #333333;
			}
			body {
				margin-left: 0px;
				margin-top: 0px;
			}
			-->
		</style>
    </head>
    <body>
    	<form action="doAddPrice" method="post" >
	        <table width="100%" border="1">
	        	<tr>
	        		<td bgcolor="#84FF84">蛋糕名称:${bread.name}</td>
	        		<td bgcolor="#84FF84">蛋糕编号:${bread.code}</td>
	        	</tr>
	        	<tr>
	        		<td bgcolor="#84FF84" colspan="2">尺寸:
		        		<input type="text" name="size" value="" /> 
	        		</td>
	        	</tr>
	        	<tr>
	        		<td bgcolor="#84FF84" colspan="2">价格:
		        		<input type="text" name="price" value="" /> 
	        		</td>
	        	</tr>
	        	<tr>
	        		<td bgcolor="#84FF84" colspan="2">
		        		<input type="hidden" name="breadId" value="${bread.id }" />
		        		<input type="submit" name="submit" value="点此添加"/>
	        		</td>
	        	</tr>
	        </table>
        </form>
        
         <table width="100%" border="1" style="margin-top: 50px;">
        	<tr>
        		<td bgcolor="#84FF84">尺寸</td>
        		<td bgcolor="#84FF84">价格</td>
        		<td bgcolor="#84FF84">创建时间</td>
        		<td bgcolor="#84FF84">操作</td>
        	</tr>
        	<c:forEach items="${breadPrices }" var="breadPrice">
	        	<tr>
	        		<td bgcolor="#84FF84">${breadPrice.size}</td>
	        		<td bgcolor="#84FF84">${breadPrice.price}</td>
	        		<td bgcolor="#84FF84">${breadPrice.createTime }</td>
	        		<td bgcolor="#84FF84">
	        			<a href="javascript:del('${breadPrice.id }')">删除</a>
					</td>
	        	</tr>
        	</c:forEach>
        	<tr>
	        		<td height="40"  align="center" colspan="20"><a href="admin_base">点此返回</a></td>
	        </tr>
        </table>
        
    </body>
</html>
